cmake_minimum_required(VERSION 3.16)
project(ChatMockServer LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Protobuf HttpServer WebSockets)
file(GLOB PB_FILES "../ChatClient/proto/*.proto")

qt_standard_project_setup()

qt_add_executable(ChatMockServer
    WIN32 MACOSX_BUNDLE
    main.cpp
    widget.cpp
    widget.h
    widget.ui
    server.h
    server.cpp
    resource.qrc
)

qt_add_protobuf(ChatMockServer PROTO_FILES ${PB_FILES})


target_link_libraries(ChatMockServer
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt6::Protobuf
        Qt6::HttpServer
        Qt6::WebSockets
)



include(GNUInstallDirs)

install(TARGETS ChatMockServer
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET ChatMockServer
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
